﻿<%@ Page Language="C#" MasterPageFile="~/Department/DepartmentMasterPage.master" AutoEventWireup="true" CodeFile="AddReward.aspx.cs" Inherits="Department_AddReward" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
 <table style="width: 100%; height: 10px">
        <tr>
            <td align="left" style="font-size: 1.2em; width: 584px; font-family: 微软雅黑; height: 21px;
                background-color: transparent">
                &nbsp;请选择班级名称：<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
                    DataSourceID="SqlDataSource1" DataTextField="班级名称" DataValueField="班级名称" Width="168px">
                </asp:DropDownList>
                学期名称：<asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="SqlDataSource2"
                    DataTextField="学期名称" DataValueField="学期名称" Width="122px">
                </asp:DropDownList>&nbsp;<asp:Button ID="Button1" runat="server" Text="查询" Width="70px" /></td>
        </tr>
        <tr>
            <td align="left" style="font-size: 1.2em; width: 584px; font-family: 微软雅黑; height: 21px;
                background-color: transparent">
                &nbsp;自动编号：<asp:TextBox ID="TextBox3" runat="server" BackColor="Silver" ReadOnly="True"
                    Width="63px"></asp:TextBox>
                班级名称：<asp:DropDownList ID="DropDownList3" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource1"
                    DataTextField="班级名称" DataValueField="班级名称" Width="140px">
                </asp:DropDownList>
                学期名称：<asp:DropDownList ID="DropDownList4" runat="server" DataSourceID="SqlDataSource2"
                    DataTextField="学期名称" DataValueField="学期名称" Width="124px">
                </asp:DropDownList><br />
                &nbsp;学生姓名：<asp:DropDownList ID="DropDownList5" runat="server" DataSourceID="SqlDataSource3"
                    DataTextField="学生姓名" DataValueField="学籍编号" Width="100px">
                </asp:DropDownList>
                奖惩日期：<asp:TextBox ID="TextBox1" runat="server" Width="101px">2000-9-10</asp:TextBox>
                奖惩类型：<asp:TextBox ID="TextBox6" runat="server" Width="118px"></asp:TextBox><br />
                &nbsp;奖惩内容：<asp:TextBox ID="TextBox2" runat="server" Width="272px">暂无</asp:TextBox>
                奖惩机关：<asp:TextBox ID="TextBox4" runat="server" Width="120px">暂无</asp:TextBox>&nbsp;
                奖惩分数:<asp:TextBox ID="TextBox7" runat="server" Width="77px"></asp:TextBox><br />
                &nbsp;补充说明：<asp:TextBox ID="TextBox5" runat="server" Width="319px">暂无</asp:TextBox>
                <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="新增" Width="70px" />
                <asp:Button ID="Button3" runat="server" OnClick="Button3_Click" Text="修改" Width="70px" /></td>
        </tr>
        <tr>
            <td style="overflow: auto; width: 584px; height: 103px; background-color: gainsboro">
                <asp:Panel ID="Panel1" runat="server" Height="250px" ScrollBars="Auto" Width="933px">
                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MySchoolDBConnectionString %>"
                        SelectCommand="SELECT DISTINCT * FROM [班级设置]"></asp:SqlDataSource>
                    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:MySchoolDBConnectionString %>"
                        SelectCommand="SELECT DISTINCT [学期名称] FROM [课程设置] WHERE ([班级名称] = @班级名称)">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="DropDownList1" Name="班级名称" PropertyName="SelectedValue"
                                Type="String" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                    <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:MySchoolDBConnectionString %>"
                        SelectCommand="SELECT * FROM [学生档案] WHERE ([班级名称] = @班级名称) AND (学籍编号 NOT IN (SELECT 学籍编号 FROM 学生离校))">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="DropDownList3" Name="班级名称" PropertyName="SelectedValue"
                                Type="String" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                    <asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:MySchoolDBConnectionString %>"
                        DeleteCommand="DELETE FROM [奖惩记录] WHERE [自动编号] = @自动编号" InsertCommand="INSERT INTO [奖惩记录] ([班级名称], [学期名称], [学籍编号], [学生姓名], [奖惩日期], [奖惩类型], [奖惩内容], [奖惩机关], [补充说明]) VALUES (@班级名称, @学期名称, @学籍编号, @学生姓名, @奖惩日期, @奖惩类型, @奖惩内容, @奖惩机关, @补充说明)"
                        SelectCommand="SELECT * FROM [奖惩记录] WHERE (([班级名称] = @班级名称) AND ([学期名称] = @学期名称)) AND (学籍编号 NOT IN (SELECT 学籍编号 FROM 学生离校))"
                        UpdateCommand="UPDATE [奖惩记录] SET [班级名称] = @班级名称, [学期名称] = @学期名称, [学籍编号] = @学籍编号, [学生姓名] = @学生姓名, [奖惩日期] = @奖惩日期, [奖惩类型] = @奖惩类型, [奖惩内容] = @奖惩内容, [奖惩机关] = @奖惩机关, [补充说明] = @补充说明 WHERE [自动编号] = @自动编号">
                        <DeleteParameters>
                            <asp:Parameter Name="自动编号" Type="Int32" />
                        </DeleteParameters>
                        <UpdateParameters>
                            <asp:ControlParameter ControlID="DropDownList3" Name="班级名称" PropertyName="SelectedValue"
                                Type="String" />
                            <asp:ControlParameter ControlID="DropDownList4" Name="学期名称" PropertyName="SelectedValue"
                                Type="String" />
                            <asp:ControlParameter ControlID="DropDownList5" Name="学籍编号" PropertyName="SelectedValue"
                                Type="String" />
                            <asp:ControlParameter ControlID="DropDownList5" Name="学生姓名" PropertyName="SelectedItem.Text"
                                Type="String" />
                            <asp:ControlParameter ControlID="TextBox1" Name="奖惩日期" PropertyName="Text" Type="DateTime" />
                            <asp:ControlParameter ControlID="TextBox6" Name="奖惩类型" PropertyName="Text" Type="String" />
                            <asp:ControlParameter ControlID="TextBox2" Name="奖惩内容" PropertyName="Text" Type="String" />
                            <asp:ControlParameter ControlID="TextBox4" Name="奖惩机关" PropertyName="Text" Type="String" />
                            <asp:ControlParameter ControlID="TextBox5" Name="补充说明" PropertyName="Text" Type="String" />
                            <asp:ControlParameter ControlID="TextBox3" Name="自动编号" PropertyName="Text" Type="Int32" />
                        </UpdateParameters>
                        <SelectParameters>
                            <asp:ControlParameter ControlID="DropDownList1" Name="班级名称" PropertyName="SelectedValue"
                                Type="String" />
                            <asp:ControlParameter ControlID="DropDownList2" Name="学期名称" PropertyName="SelectedValue"
                                Type="String" />
                        </SelectParameters>
                        <InsertParameters>
                            <asp:ControlParameter ControlID="DropDownList3" Name="班级名称" PropertyName="SelectedValue"
                                Type="String" />
                            <asp:ControlParameter ControlID="DropDownList4" Name="学期名称" PropertyName="SelectedValue"
                                Type="String" />
                            <asp:ControlParameter ControlID="DropDownList5" Name="学籍编号" PropertyName="SelectedValue"
                                Type="String" />
                            <asp:ControlParameter ControlID="DropDownList5" Name="学生姓名" PropertyName="SelectedItem.Text"
                                Type="String" />
                            <asp:ControlParameter ControlID="TextBox1" Name="奖惩日期" PropertyName="Text" Type="DateTime" />
                            <asp:ControlParameter ControlID="TextBox6" Name="奖惩类型" PropertyName="Text" Type="String" />
                            <asp:ControlParameter ControlID="TextBox2" Name="奖惩内容" PropertyName="Text" Type="String" />
                            <asp:ControlParameter ControlID="TextBox4" Name="奖惩机关" PropertyName="Text" Type="String" />
                            <asp:ControlParameter ControlID="TextBox5" Name="补充说明" PropertyName="Text" Type="String" />
                        </InsertParameters>
                    </asp:SqlDataSource>
                    &nbsp;
                    <asp:Panel ID="Panel2" runat="server" Height="238px" Width="773px">
                    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White"
                        BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" CellSpacing="1"
                        DataKeyNames="自动编号" DataSourceID="SqlDataSource4" Font-Names="宋体" Font-Size="Small"
                        GridLines="None" OnRowCreated="GridView1_RowCreated" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
                        Width="791px">
                        <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
                        <Columns>
                            <asp:CommandField ButtonType="Button" HeaderText="选择" ShowSelectButton="True" />
                            <asp:TemplateField HeaderText="删除" ShowHeader="False">
                                <ItemTemplate>
                                    <asp:Button ID="Button1" runat="server" CausesValidation="False" CommandName="Delete"
                                        Text="删除" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="自动编号" HeaderText="自动编号" InsertVisible="False" ReadOnly="True"
                                SortExpression="自动编号" />
                            <asp:BoundField DataField="班级名称" HeaderText="班级名称" SortExpression="班级名称" />
                            <asp:BoundField DataField="学期名称" HeaderText="学期名称" SortExpression="学期名称" />
                            <asp:BoundField DataField="学籍编号" HeaderText="学籍编号" SortExpression="学籍编号" />
                            <asp:BoundField DataField="学生姓名" HeaderText="学生姓名" SortExpression="学生姓名" />
                            <asp:BoundField DataField="奖惩日期" HeaderText="奖惩日期" SortExpression="奖惩日期" />
                            <asp:BoundField DataField="奖惩类型" HeaderText="奖惩类型" SortExpression="奖惩类型" />
                            <asp:BoundField DataField="奖惩内容" HeaderText="奖惩内容" SortExpression="奖惩内容" />
                            <asp:BoundField DataField="奖惩机关" HeaderText="奖惩机关" SortExpression="奖惩机关" />
                            <asp:BoundField DataField="补充说明" HeaderText="补充说明" SortExpression="补充说明" />
                        </Columns>
                        <RowStyle BackColor="#DEDFDE" ForeColor="Black" />
                        <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
                        <HeaderStyle BackColor="Navy" Font-Bold="True" ForeColor="#E7E7FF" HorizontalAlign="Center" />
                    </asp:GridView>
                    </asp:Panel>
                </asp:Panel>
            </td>
        </tr>
    </table>
</asp:Content>

